Take K Of Each Character From Left And Right - Leetcode - Python